using System;
using System.Collections.Generic;

namespace Mercenary
{
    public class StraAutoTask : IStrategy
    {
        public static string m_name = UiItemConst.策略_自动任务.m_name;
        public List<MercCard> m_mercList = new List<MercCard>();

        public string Name() { return m_name; }

        public List<MercCard> GetMercList() { return m_mercList; }

        public (int hand_index, int play_index) GetEnterOrder(
            List<MercCard> hand_mercenaries,
            List<MercCard> play_mercenaries)
        {
            int 鞭笞者特里高雷 = UtilsStra.FindMercenaryIndexForName(
                "鞭笞者特里高雷", play_mercenaries);
            if (鞭笞者特里高雷 == 0)
                return (0, 鞭笞者特里高雷);
            else if (鞭笞者特里高雷 > 0)
                return (0, 鞭笞者特里高雷 + 1);
            return (0, play_mercenaries.Count);
        }

        public void UpdateMercList()
        {
            m_mercList.Clear();
            /*
            foreach (Task task in UtilsTask.GetTaskList())
            {
                if(task.m_title.Contains("展开双翼") ||
                    task.m_title.Contains("黑王子之站"))
                {
                    m_mercList.Add(new MercCard(task.m_mercId,EquipConst.黑龙鳞片.m_id));
                    m_mercList.Add(new MercCard(MercConst.玉珑.m_id,0));
                    m_mercList.Add(new MercCard(MercConst.赤精.m_id, EquipConst.赤精之杖.m_id));
                }
                else
                {
                    m_mercList.Add(new MercCard(task.m_mercId,0));
                    //最大添加6个，可以带非满级英雄升级或者急需全满的英雄作后备，多样化
                    //if(玩家收藏里面实际存在如下3个则一起添加，否则不添加，然后换一组佣兵)
                    //{
                    //m_mercList.Add(new MercCard(task.m_mercId,EquipConst.黑龙鳞片.m_id));
                    //m_mercList.Add(new MercCard(MercConst.玉珑.m_id,0));
                    //m_mercList.Add(new MercCard(MercConst.赤精.m_id,EquipConst.赤精之杖.m_id));
                    //}
                }
            }
            */
        }

        public List<BattleTarget> GetBattleTargets(
            int turn,
            List<MercCard> targets_opposite_all,
            List<MercCard> targets_friendly_all,
            List<MercCard> targets_opposite_graveyrad)
        {
            var battleTargetEntities = new List<BattleTarget>();
            /*
            var maxHealthTarget = UtilsStra.FindMaxHealthTarget(targets_opposite);

            foreach (Task task in UtilsTask.GetTaskList())
            {
                if(task.m_title.Contains("展开双翼") ||
                    task.m_title.Contains("黑王子之站"))
                {
                    var merc = UtilsStra.FindMercenaryForId(task.m_mercId, mercenaries);
                    if(merc!=null)
                    {
                        battleTargetEntities.Add(new BattleTarget()
                        {
                            m_oppoTarId = maxHealthTarget?.m_id ?? -1,
                            //UtilsStra.FindSkillForId(真正形态, merc)
                            m_skillId = UtilsStra.FindSkillForName("真正形态", merc)?.m_id ?? -1
                        });
                    }
                    merc = UtilsStra.FindMercenaryForId(MercConst.玉珑.m_id, mercenaries);
                    if(merc!=null)
                    {
                        battleTargetEntities.Add(new BattleTarget()
                        {
                            m_oppoTarId = maxHealthTarget?.m_id ?? -1,
                            m_skillId = UtilsStra.FindSkillForName("玉火打击", merc)?.m_id ?? -1
                        });
                    }
                    merc = UtilsStra.FindMercenaryForId(MercConst.赤精.m_id, mercenaries);
                    if(merc!=null)
                    {
                        battleTargetEntities.Add(new BattleTarget()
                        {
                            m_oppoTarId = maxHealthTarget?.m_id ?? -1,
                            m_skillId = UtilsStra.FindSkillForName("振奋之歌", merc)?.m_id ?? -1
                        });
                    }
                }
                else
                {

                }
            }
            */

            return battleTargetEntities;
        }
    }
}
